package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 * @author hua
 * @since 2024-12-11
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@NoArgsConstructor
@TableName("t_stock_picking")
public class StockPickingDo extends Model<StockPickingDo> {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 主表表id
     */
    @TableField("order_id")
    private Long orderId;

    /**
     * 主表类型  Stock_Pick_OrderType
     */
    @TableField("order_type")
    private String orderType;

    @TableField("product_id")
    private Long productId;
    @TableField(value = "company_id", fill = FieldFill.INSERT)
    private Long companyId;
    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    private Long tenantId;
    @TableField("wh_id")
    private Long whId;

    /**
     * 数量
     */
    @TableField("quantity")
    private Integer quantity;
    @TableField("picked_qty")
    private Integer pickedQty;

    /**
     * 出库数量
     */
    @TableField("out_qty")
    private Integer outQty;

    /**
     * 库位id
     */
    @TableField("rack_id")
    private Long rackId;

    @TableField("sub_stock_id")
    private Long subStockId;

    /**
     * 产品类型 sku box
     */
    @TableField("sku_type")
    private String skuType;

    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private Long createBy;

    @TableField("delete_time")
    private Date deleteTime;

    @TableField("delete_by")
    private Long deleteBy;


    public StockPickingDo(Long whId, Long orderId, String orderType, String skuType, Long productId, Long rackId, Long subStockId, Integer quantity) {
        this.orderId = orderId;
        this.orderType = orderType;
        this.productId = productId;
        this.whId = whId;
        this.quantity = quantity;
        this.rackId = rackId;
        this.subStockId = subStockId;
        this.skuType = skuType;
    }

    public StockPickingDo(Long whId, Long orderId, String orderType, String skuType, Long productId, Long rackId, Long subStockId, Integer quantity, Integer pickedQty) {
        this.orderId = orderId;
        this.orderType = orderType;
        this.productId = productId;
        this.whId = whId;
        this.quantity = quantity;
        this.rackId = rackId;
        this.subStockId = subStockId;
        this.skuType = skuType;
        this.pickedQty = pickedQty;
    }


    public StockPickingDo(Long companyId, Long whId, Long orderId, String orderType, String skuType, Long productId, Long rackId, Long subStockId, Integer quantity, Integer pickedQty) {
        this.companyId = companyId;
        this.orderId = orderId;
        this.orderType = orderType;
        this.productId = productId;
        this.whId = whId;
        this.quantity = quantity;
        this.rackId = rackId;
        this.subStockId = subStockId;
        this.skuType = skuType;
        this.pickedQty = pickedQty;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
